package leetcode;

import org.junit.Test;

/**
 * @author yu
 * @create 2021-12-27 16:24
 */
public class LeetCode11 {

    /**
     * 9. 回文数
     */
    @Test
    public void test11(){
        int[] height = {1,2,1};
        int i = maxArea(height);
        System.out.println(i);
    }
    public int maxArea(int[] height) {
        int max = 0;
        int len = height.length;
        int left = 0;
        int right = len - 1;
        while (right - left >= 1){
            if(height[left] < height[right]){
                int area = (right - left) * height[left];
                max = Math.max(max,area);
                left++;
            } else {
                int area = (right - left) * height[right];
                max = Math.max(max,area);
                right--;
            }
        }

        return max;
    }
}
